package com.kws.system.controller.Payment;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import com.kws.common.core.domain.R;
import com.kws.system.domain.info.QueryAccountManagementInfo;
import com.kws.system.domain.vo.CreateAccountManagementRq;
import com.kws.system.domain.vo.QueryAccountManagementRq;
import com.kws.system.domain.vo.UpdateAccountManagementRq;
import com.kws.system.service.AccountManagementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <b>AccountManagementController</b>
 *
 * @description: AccountManagementController <br>
 * @date: 2024/11/8 14:41 <br>
 * @author: lhm <br>
 * @version: 1.0 <br>
 */

@Api(tags = "商户账户管理模块")
@RestController
public class AccountManagementController {
    private static final Logger logger = LoggerFactory.getLogger(AccountManagementController.class);

    @Autowired
    private AccountManagementService accountManagementService;

    @ApiOperation("分页查询账户管理列表")
    @PostMapping("/query/account/page")
    public R<Page<QueryAccountManagementInfo>> queryAccountPage(@RequestBody QueryAccountManagementRq rq){
        Page<QueryAccountManagementInfo> pageInfo = accountManagementService.queryAccountPage(rq);
        return R.ok(pageInfo);
    }

//    @ApiOperation("新增账户信息")
//    @PostMapping("/create/account")
//    public R createAccount(@RequestBody CreateAccountManagementRq rq){
//        boolean status = accountManagementService.createAccount(rq);
//        return R.ok(status);
//    }

    @ApiOperation("根据ID查询账户信息详情")
    @GetMapping("/query/account/byId")
    public R<QueryAccountManagementInfo> queryAccountById(@RequestParam Long id){
        QueryAccountManagementInfo info = accountManagementService.queryAccountById(id);
        return R.ok(info);
    }

    @ApiOperation("修改账户信息")
    @PostMapping("/update/account")
    public R updateAccount(@RequestBody UpdateAccountManagementRq rq){
        boolean status = accountManagementService.updateAccount(rq);
        return R.ok(status);
    }



    @ApiOperation("根据ID删除账户信息")
    @GetMapping("/delete/account/byId")
    public R deleteAccountById(@RequestParam Long id){
        boolean status = accountManagementService.deleteAccountById(id);
        return R.ok(status);
    }
}
